﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using XMK.Tadong.Biz;
using XMK.Framework.Model;
using XMK.Utils;

namespace XMK.Tadong.Web.Handlers
{
    /// <summary>
    /// CommonSearchHandler 的摘要说明
    /// </summary>
    public class CommonSearchHandler : IHttpHandler {

        public void ProcessRequest (HttpContext context) {

            string resultJson = "[]";
            string op = context.Request.Params.Get("optype");
            switch (op)
            {
                case "queryalluser":
                default:
                    resultJson = QueryAllUser();
                    break;
            }

            context.Response.ContentType = "text/json";
            context.Response.Write(resultJson);
            context.Response.End();

        }

        private string QueryAllUser()
        {
            Base_RM_UserInfoBiz biz = new Base_RM_UserInfoBiz();
            ResponseInfo res = biz.QueryAllUser();
            if (!string.IsNullOrEmpty(res.ErrMsg))
                return "[]";
            return JsonHelper.ToJson(res.Data);
        }
     
        public bool IsReusable {
            get {
                return false;
            }
        }
    }
}